package com.mark.entity;

import java.util.HashMap;
import java.util.Map;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.MapKeyColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.paper.entity.Subtopics;
import com.question.entity.Options;

@Entity
@Table(name="t_stuoptions")
public class StuOptions {
	private Long id;
	private Map<Integer, Options> options = new HashMap<Integer,Options>();
	private float score;
	private Subtopics subtopics;
	private boolean marked;
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	@OneToMany(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
	@JoinTable(name="t_stuoptions_options",inverseJoinColumns=@JoinColumn(name="option_id"))
	@MapKeyColumn(name="option_key")
	public Map<Integer, Options> getOptions() {
		return options;
	}
	@ManyToOne(fetch=FetchType.EAGER)
	public Subtopics getSubtopics() {
		return subtopics;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setOptions(Map<Integer, Options> options) {
		this.options = options;
	}

	public void setSubtopics(Subtopics subtopics) {
		this.subtopics = subtopics;
	}
	public float getScore() {
		return score;
	}
	public void setScore(float score) {
		this.score = score;
	}
	public boolean isMarked() {
		return marked;
	}
	public void setMarked(boolean marked) {
		this.marked = marked;
	}
	
}
